﻿using System;
using System.Windows.Data;

namespace RG.Common.WPF.Workplaces
{
    [ValueConversion(typeof(string), typeof(double))]
    public class NameToWidthConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null) return 24;
            var s = (string) value;
            var a = s.Length*7;
            return a > 24 ? s.Length*7 : 24;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
